package threadcoreknowledge.stopthreads;

import java.util.Scanner;

public class CantInterruptIO {
    public static void main(String[] args) throws InterruptedException {
        Runnable runnable = () -> {
            while (!Thread.currentThread().isInterrupted()) {
                Scanner in = new Scanner(System.in);
                in.next();
                System.out.println("interrupted");
            }
        };
        Thread t = new Thread(runnable);
        t.start();
        Thread.sleep(2000);
        t.interrupt();
        System.out.println("send interrupt signal");
    }
}
